package com.xunshibao.spring.validator;

import org.springframework.validation.Errors;

public class ValidationTools {
	private SpringExtValidatorFactory factory;

	public void setFacotry(SpringExtValidatorFactory factory) {
		this.factory = factory;
	}
	
	public boolean validate(String path, Object bean, Errors errors) {
		try {
			factory.getValidator(path, bean, errors).validate();
			return true;
		} catch (Exception e) {
			return false;
		}
	}
}
